<template>
	<view>
		<view v-for="item in newslist" style="margin: 10rpx;">
			<xinwen
				:title = "item.title"
				:author = "item.author"
				:comments = "item.comments"
				:timedata = "item.timedata"
				:isTop="item.isTop"
				:mode="item.newstype"
				:image="item.imagelist[0]"
				
				@click="goDetailPage()">
				<template v-slot:tips>
					<view class="slotcontent" v-if="item.showSearch">
						<text style="color: blue;">搜索：</text>
						<view class="borderbox" style="color: blue;"><text>精选报道</text></view>
					</view>
				</template>
			</xinwen>
		</view>
	</view>
</template>

<script>
	import xinwen from "../../components/xinwen.vue"
	export default {
		components:{
			xinwen
		},
		data() {
			return {
				newslist:[
				{
				newstype:1, //无图
				title:"中共中央关于制定国民经济和社会发展第十五个五年规划的建议",
				author:"人民日报",
				comments:555,
				timedata:"2025.10.25",
				isTop:true,
				showSearch:true,
				imagelist:[],
				},
				
				{
				newstype:1,
				title:"20光年外发现“超级地球”，比地球更大，或有地外生命存在",
				author:"常观",
				comments:565,
				timedata:"2025.10.29",
				isTop:true,
				imagelist:[ ],
				},
				
				{
				newstype:2,  //单图
				title:"正式确认，终老火箭！杜兰特官宣退役声明，太阳终究是错付了",
				author:"九七体育",
				comments:529,
				timedata:"2025.10.28",
				isTop:false,
				imagelist:["/static/new1.png"]
				},
				
				{
				newstype:2,
				title:"自带“青霉素”的5种蔬菜，建议：天冷经 常吃，提高免疫力少生病",
				author:"爱享美食家",
				comments:417,
				timedata:"2025.10.14",
				isTop:false,
				imagelist:["/static/new3.png"]
				},
				
				{
				newstype:2,
				title:"71岁钟睒睒拿下中国首富，身家5300亿，创造历史",
				author:"读者",
				comments:198,
				timedata:"2025.10.29",
				isTop:false,
				imagelist:["/static/new2.png"]
				},
				{
					newstype:1, //多图(广告)
					title:"加微信交友群，喜欢就聊，找喜欢的人",
					author:"广告",
					comments:0,
					timedata:"2025.11.5",
					isTop:false,
					imagelist:[],
					
				}
				]
			}
		},
		onLoad() {
			this.xinwen = getAppp().globalData.datalist;
			
			console.log("onLoad --> user" + getApp().globalData.username);
			console.log("onLoad --> xinwen: " + this.xinwen.length);
		},
		methods: {
			goDetailPage(){
				
			}
		}
	}
</script>

<style>
.slotcontent{
	font-size: 30rpx;
}
</style>
